import 'package:flutter/material.dart';
import 'package:shopping_group/entity/task_entity.dart';
import 'package:shopping_group/modle/more/ui/more_st_page.dart';
import 'package:shopping_group/modle/pingtuan/entity/groupIns4app_record_entity.dart';
import 'package:shopping_group/res/colors.dart';
import 'package:shopping_group/res/dimens.dart';
import 'package:shopping_group/utils/route_util.dart';
import 'package:shopping_group/utils/widget_utils.dart';
import 'package:shopping_group/view/button_progress_view.dart';

class PingtuanCompleteDetailsPage extends StatefulWidget {
  final GroupIns4AppRecordEntity entity;
  PingtuanCompleteDetailsPage({Key key, @required this.entity})
      : super(key: key);

  @override
  _PingtuanCompleteDetailsPageState createState() =>
      _PingtuanCompleteDetailsPageState();
}

class _PingtuanCompleteDetailsPageState
    extends State<PingtuanCompleteDetailsPage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: WidgetUtils.showAppar(context, '订单详情'),
      body: Container(
        height: double.infinity,
        decoration: BoxDecoration(
          color: Colours.title_white,
        ),
        child: Column(
          children: <Widget>[
            Expanded(
              child: SingleChildScrollView(
                scrollDirection: Axis.vertical,
                reverse: false,
                padding: EdgeInsets.all(0.0),
                physics: BouncingScrollPhysics(),
                child: Column(
                  children: <Widget>[
                    _shoppingView(),
                    WidgetUtils.drawCodeDivider(height: 4),
                    _priceInfoView(),
                    WidgetUtils.drawCodeDivider(height: 4),
                    _orderInfoView(),
                    WidgetUtils.drawCodeDivider(height: 4),
                    _kuaidiInfoView(),
                  ],
                ),
              ),
            ),
            ButtonProgressView.crateCupertinoView('再来一单',
                blackColor: Colours.main_01, cupertinoCall: () {
              RouteUtil.goParameter(MoreStPage(
                id: this.widget.entity.groupSpecId,
                title: this.widget.entity.sucMenCt,
              ));
            }),
          ],
        ),
      ),
    );
  }

  Widget _kuaidiInfoView() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        SizedBox(
          height: 16,
        ),
        Padding(
          padding: EdgeInsets.symmetric(horizontal: 16),
          child: WidgetUtils.getTextColorView(
            '快递信息',
            Colours.text_2222,
            Dimens.FONT_SIZE_18,
          ),
        ),
        SizedBox(
          height: 16,
        ),
        WidgetUtils.drawCodeDivider(height: 1),
        WidgetUtils.itmeStyleView('发货时间', '2020-09-01 17:09:09',
            textSize: Dimens.FONT_SIZE_14,
            contentColor: Colours.text_91,
            isExpanded: false,
            bewteenleft: 8,
            verticalPadding: 16),
        WidgetUtils.itmeStyleView('快递公司', '',
            textSize: Dimens.FONT_SIZE_14,
            contentColor: Colours.text_91,
            isExpanded: false,
            bewteenleft: 8,
            verticalPadding: 16),
        WidgetUtils.itmeStyleView('快递单号', '',
            textSize: Dimens.FONT_SIZE_14,
            contentColor: Colours.text_91,
            isExpanded: false,
            bewteenleft: 8,
            verticalPadding: 16),
      ],
    );
  }

  Widget _orderInfoView() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        SizedBox(
          height: 16,
        ),
        Padding(
          padding: EdgeInsets.symmetric(horizontal: 16),
          child: WidgetUtils.getTextColorView(
            '订单信息',
            Colours.text_2222,
            Dimens.FONT_SIZE_18,
          ),
        ),
        SizedBox(
          height: 16,
        ),
        WidgetUtils.drawCodeDivider(height: 1),
        WidgetUtils.itmeStyleView('推广编号', '4456633355',
            textSize: Dimens.FONT_SIZE_14,
            contentColor: Colours.text_91,
            isExpanded: false,
            bewteenleft: 8,
            verticalPadding: 16),
        WidgetUtils.itmeStyleView('订单编号', '33422346789999',
            textSize: Dimens.FONT_SIZE_14,
            contentColor: Colours.text_91,
            isShowText: true,
            isShow: false,
            isExpanded: false,
            isContentExpanded: true,
            bewteenleft: 8,
            verticalPadding: 16),
        WidgetUtils.itmeStyleView('推广时间', '2020-09-01 17:09:09',
            textSize: Dimens.FONT_SIZE_14,
            contentColor: Colours.text_91,
            isExpanded: false,
            bewteenleft: 8,
            verticalPadding: 16),
        WidgetUtils.itmeStyleView('成团时间', '2020-09-01 17:09:09',
            textSize: Dimens.FONT_SIZE_14,
            contentColor: Colours.text_91,
            isExpanded: false,
            bewteenleft: 8,
            verticalPadding: 16),
        WidgetUtils.itmeStyleView('支付方式', '支付宝支付',
            textSize: Dimens.FONT_SIZE_14,
            contentColor: Colours.text_91,
            isExpanded: false,
            bewteenleft: 8,
            verticalPadding: 16),
        WidgetUtils.itmeStyleView('支付时间', '2020-09-01 17:09:09',
            textSize: Dimens.FONT_SIZE_14,
            contentColor: Colours.text_91,
            isExpanded: false,
            bewteenleft: 8,
            verticalPadding: 16),
      ],
    );
  }

  Widget _priceInfoView() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        SizedBox(
          height: 16,
        ),
        Padding(
          padding: EdgeInsets.symmetric(horizontal: 16),
          child: WidgetUtils.getTextColorView(
            '价格信息',
            Colours.text_2222,
            Dimens.FONT_SIZE_18,
          ),
        ),
        SizedBox(
          height: 16,
        ),
        WidgetUtils.drawCodeDivider(height: 1),
        WidgetUtils.itmeStyleView(
          '商品总价格',
          '¥${this.widget.entity.rechargeVal}',
          textSize: Dimens.FONT_SIZE_14,
          textColor: Colours.text_2222,
          contentColor: Colours.themeColor,
          contentAlignment: Alignment.centerRight,
        ),
        WidgetUtils.itmeStyleView(
          '运费',
          '¥0.0',
          textSize: Dimens.FONT_SIZE_14,
          textColor: Colours.text_2222,
          contentColor: Colours.themeColor,
          contentAlignment: Alignment.centerRight,
        ),
        WidgetUtils.itmeStyleView(
          '数量',
          '1',
          textSize: Dimens.FONT_SIZE_14,
          textColor: Colours.text_2222,
          contentColor: Colours.themeColor,
          contentAlignment: Alignment.centerRight,
        ),
        WidgetUtils.itmeStyleView(
          '应付金额',
          '¥${this.widget.entity.rechargeVal}',
          textSize: Dimens.FONT_SIZE_14,
          textColor: Colours.text_2222,
          contentColor: Colours.themeColor,
          contentAlignment: Alignment.centerRight,
        ),
        WidgetUtils.itmeStyleView(
          '获得奖金',
          '¥3',
          textSize: Dimens.FONT_SIZE_14,
          textColor: Colours.text_2222,
          contentColor: Colours.themeColor,
          contentAlignment: Alignment.centerRight,
        ),
        WidgetUtils.itmeStyleView(
          '获得积分',
          '¥2',
          textSize: Dimens.FONT_SIZE_14,
          textColor: Colours.text_2222,
          contentColor: Colours.themeColor,
          contentAlignment: Alignment.centerRight,
        ),
        WidgetUtils.itmeStyleView(
          '获得消费金',
          '¥1',
          textSize: Dimens.FONT_SIZE_14,
          textColor: Colours.text_2222,
          contentColor: Colours.themeColor,
          contentAlignment: Alignment.centerRight,
        ),
      ],
    );
  }

  Widget _shoppingView() {
    return Container(
      decoration: BoxDecoration(
        color: Colours.title_white,
      ),
      padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
      child: Row(
        children: <Widget>[
          Container(
            height: 110.0,
            width: 110.0,
            margin: const EdgeInsets.all(5.0),
            child: FadeInImage.assetNetwork(
              image: this.widget.entity.imgUrl,
              placeholder: 'images/picture_loading.png' /* 指定gif */,
              fit: BoxFit.contain,
            ),
          ),
          Expanded(
            child: Padding(
              padding: const EdgeInsets.only(left: 16),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  SizedBox(
                    height: 4,
                  ),
                  WidgetUtils.getTextColorView(
                    '${this.widget.entity.rechargeVal}元/${this.widget.entity.sucMenCt}人团',
                    Colours.text_2222,
                    Dimens.FONT_SIZE_14,
                  ),
                  SizedBox(
                    height: 4,
                  ),
                  Column(
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      WidgetUtils.getTextColorView('先付款,后选品；购物不纠结,让推广更简单',
                          Colours.gray_91, Dimens.FONT_SIZE_14),
                      SizedBox(
                        height: 4,
                      ),
                      WidgetUtils.getTextColorView(
                          '¥${this.widget.entity.rechargeVal}/件 共1件商品',
                          Colours.text_2222,
                          Dimens.FONT_SIZE_14,
                          decorationColor: Colours.text_2222),
                    ],
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }

  @override
  void dispose() {
    super.dispose();
  }
}
